import socket
sk = socket.socket()
sk.bind(('127.0.0.1',9000))
sk.listen()
try:
    conn,addr = sk.accept()
    ret = conn.recv(1024)
    print(ret)
    # conn.send(b'HTTP/1.1 200 OK \r\n\r\n')
    # conn.send('你好'.encode('GBK'))    # bytes
    with open('new.html',encoding='utf-8') as f:
        conn.send(f.read().encode('GBK'))
except Exception as e:
    print(e)
finally:
    conn.close()
    sk.close()